 import apiType, {
    GET_CUSTOMER_MEMBER_LIST,
    GET_CUSTOMER_MEMBER_SELECTION,
    GET_CUSTOMER_LIST,
    GET_CUSTOMER_SUMMERY,
} from '@constants/ActionTypes'

const initialState = {
    customerMemberListMap: {}, // 会员卡列表
    customerMemberSelectionMap: {}, // 会员卡下拉列表
    customerListMap: {}, // 客户列表
    customerSummery: {}, // 客户概况
}

export default function update(state = initialState, action) {
    const { response, params, payload } = action
    switch (action.type) {
        case apiType(GET_CUSTOMER_MEMBER_LIST).success:
            return {
                ...state,
                customerMemberListMap: response,
            }
        case apiType(GET_CUSTOMER_MEMBER_SELECTION).success:
            return {
                ...state,
                customerMemberSelectionMap: response,
            }
        case apiType(GET_CUSTOMER_LIST).success:
            return {
                ...state,
                customerListMap: response,
            }
        case apiType(GET_CUSTOMER_SUMMERY).success:
            return {
                ...state,
                customerSummery: response,
            }
        default:
            return state
    }
}
